﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Swagger;

// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860

namespace lyAdmin.Controllers.Api
{
    [Route("api/[controller]")]
    [ApiController]
    public class ApiTestController : ControllerBase
    {
        // GET: api/<ApiTestController>
        /// <summary>
        /// 获取数组
        /// </summary>
        /// <returns>字符串数组</returns>
        [HttpGet] 
        public IEnumerable<string> Get()
        {
            return new string[] { "value1", "value2" };
        }


        [HttpGet("GetName/get")]
        public ActionResult<string> Name()
        {
            return "lyadmin";
        }

        // GET api/<ApiTestController>/5
        /// <summary>
        /// 获取id
        /// </summary>
        /// <param name="id">传入id</param>
        /// <returns>输出id</returns>
        [HttpGet("{id}",Name="x")] 
        public string Get(int id)
        {
            return "value:"+id;
        }

        // POST api/<ApiTestController>
        [HttpPost] 
        public void Post([FromBody] string value)
        {
        }

        // PUT api/<ApiTestController>/5
        [HttpPut("{id}")] 
        public void Put(int id, [FromBody] string value)
        {
        }

        // DELETE api/<ApiTestController>/5
        [HttpDelete("{id}")] 
        public void Delete(int id)
        {
        }
    }
}
